﻿// (c) Copyright 2013 Mike Riedel.
// This source is subject to the Microsoft Public License (Ms-PL).
// All other rights reserved.

using FreshMeat.Storage;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Storage.More.Test
{
   [TestClass]
   public class FileStoreTest : CommonStoreTest
   {
      /// <summary>
      /// Returns a fresh instance for base class tests.
      /// </summary>
      /// <returns></returns>
      protected override IStore<int, Data> CreateStore()
      {
         var rootFolder = GetFolder();
         var fileSystem = new FileSystem(rootFolder);

         var store = new FileStore<int, Data>(fileSystem, new JsonSerializer<Data>());
         return store;
      }

      string GetFolder()
      {
         return System.IO.Path.Combine(TestContext.TestDir, System.IO.Path.GetRandomFileName());
      }

      // ReSharper disable MemberCanBePrivate.Global
      // ReSharper disable UnusedAutoPropertyAccessor.Global
      public TestContext TestContext { get; set; }
      // ReSharper restore UnusedAutoPropertyAccessor.Global
      // ReSharper restore MemberCanBePrivate.Global
   }
}